/**
 * 作者:李杰
 * email: maillijie@gmail.com
 */
package com.javainfo.service.inf;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;

import org.springframework.dao.DataAccessException;

import com.javainfo.dao.ConditionMap;

public interface BaseServiceIf<T> {

	/**
	 * 根据Id查询
	 * 
	 * @param userId
	 * @return
	 */

	public T getById(int id);

	/**
	 * 查询全部
	 * 
	 * @return
	 * @throws ClassNotFoundException
	 * @throws DataAccessException
	 */

	public List<T> getAll();

	/**
	 * 获取数量
	 * 
	 * @return
	 * @throws ClassNotFoundException
	 * @throws DataAccessException
	 */
	public int getListSize();

	/**
	 * 追加
	 * 
	 * @param user
	 */
	public void add(T obj);

	/**
	 * 追加复数个
	 * 
	 * @param user
	 */
	public void addAll(Collection<T> objs);

	/**
	 * 删除
	 * 
	 * @param user
	 */
	public void delete(T obj);

	/**
	 * 删除复数个
	 * 
	 * @param userList
	 */
	public void deleteAll(Collection<T> list);

	/**
	 * 更新数据
	 * 
	 * @param user
	 */
	public void update(T obj);

	/**
	 * 更新复数个数据
	 * 
	 * @param user
	 */
	public void updateAll(Collection<T> objs);

	/**
	 * 按条件查询
	 * 
	 * @return
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 * @throws NoSuchMethodException
	 * @throws SecurityException
	 * @throws InvocationTargetException
	 * @throws IllegalArgumentException
	 */

	public List<T> getByConditions(Collection<ConditionMap> conditions)
			throws InstantiationException, IllegalAccessException,
			SecurityException, NoSuchMethodException, IllegalArgumentException,
			InvocationTargetException;

	/**
	 * 按条件查询 传入的对象的属性值查询
	 * 
	 * @param t
	 * @return
	 */

	public List<T> getByTemp(T t);

	/**
	 * 获取分页数据
	 * 
	 * @return
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 */

	public List<T> pageByConditions(T t, int start, int limit)
			throws InstantiationException, IllegalAccessException;

	/**
	 * 获取分页数据
	 * 
	 * @return
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 */

	public List<T> getByPage(int start, int limit)
			throws InstantiationException, IllegalAccessException;
}
